<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<script type="text/javascript">
var bjId="";
$(function(){
	$('#dialog2').dialog({
		autoOpen:false,
		title:"编辑",
		model:true,
		width:400,
		buttons:[{
			text:'提交',
			click:function(){
				var form=$(this).find('form');
				var params=form.serialize();
				$.post('studentmanage/save',params,function(data){
					refreshTable();					
				})
				$(this).dialog('close');
			}
		},{
			text:'退出',
		click:function(){
			$(this).dialog('close');
			}
		}]
	})
})

function bjChange(Id) {
	bjId=Id;
	refreshTable();
}
function refreshTable(){
	$('#myTable').load('studentmanage/table',{bjId:bjId},function(){
		});
}
function xg(id){
	var dialog=$('#dialog2');
	dialog.load('studentmanage/update',{id:id},function(){
		dialog.dialog('open');
	})
}
function add() {
	var dialog=$('#dialog2');
	dialog.load('studentmanage/edit',{bjId:bjId},function(){
		dialog.dialog('open');
	})
}
function dele(id) {
	if(confirm('是否要删除这条记录？')){
		$.post('studentmanage/delete',{id:id},function(data){
			refreshTable();
		})
	}
}
function reset(id){
	if(confirm('是否要重置改学生密码？')){
		$.post('studentmanage/resetpwd',{id:id},function(data){
			refreshTable();
		})
	}
}
</script>
<div id="dialog2" style="display: none;"></div>
<div class="aaa">
	<p>
		<label>班级：</label> 
		<select id="bj" onchange="bjChange(this.value)">
			<option value="0">---请选择班级---</option>
			<c:forEach items="${bjs}" var="bj">
				<option value="${bj.id}">${bj.name}</option>
			</c:forEach>
		</select>

	</p>
	<div id="myTable"></div>
</div>